<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>{$title|default="编辑信息"}</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="__STATIC__/component/x-admin/css/x-admin.css" media="all">
</head>
<body>
<div class="x-body">
    <form class="layui-form">
        <!--邮箱-->
        <div class="layui-form-item">
            <label for="L_email" class="layui-form-label">邮箱</label>
            <div class="layui-input-inline">
                <input type="text" id="L_email" name="email" required lay-verify="email" autocomplete="off" value="{$list.email}" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">如果您在邮箱已激活的情况下，变更了邮箱，需<a href="#" style="font-size: 12px; color: #4f99cf;">重新验证邮箱</a>。
            </div>
        </div>
        <!--昵称-->
        <div class="layui-form-item">
            <label for="L_username" class="layui-form-label">昵称</label>
            <div class="layui-input-inline">
                <input type="text" id="L_username" name="nickname" required lay-verify="required" autocomplete="off" value="{$list.nickname}" class="layui-input">
            </div>
            <!--性别-->
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <input type="radio" name="sex" value="1" checked title="男">
                    <input type="radio" name="sex" value="0" title="女">
                </div>
            </div>
        </div>
        <!--手机号-->
        <div class="layui-form-item">
            <label for="L_city" class="layui-form-label">手机号</label>
            <div class="layui-input-inline">
                <input type="text" id="L_city" name="mobile" autocomplete="off" value="{$list.mobile}" class="layui-input">
            </div>
        </div>
        <!--个性签名-->
        <div class="layui-form-item layui-form-text">
            <label for="L_sign" class="layui-form-label">个性签名</label>
            <div class="layui-input-block">
                <textarea placeholder="随便写些什么刷下存在感" id="L_sign" name="sign" autocomplete="off" class="layui-textarea" style="height: 80px;">{$list.sign}</textarea>
            </div>
        </div>
        <!--ID作为隐藏域提交至后台-->
        <input type="hidden" name="id" value="{$list.id}">
        <div class="layui-form-item">
            <label for="L_sign" class="layui-form-label"></label>
            <button class="layui-btn" key="set-mine" lay-filter="save" lay-submit data-id="{$list.id}">保存</button>
        </div>
    </form>
</div>
<script src="__STATIC__/component/x-admin/lib/layui/layui.js" charset="utf-8"></script>
<script src="__STATIC__/component/x-admin/js/x-layui.js" charset="utf-8"></script>
<script>
    layui.use(['form', 'layer'], function () {
        $ = layui.jquery;
        var form = layui.form(), layer = layui.layer;

        //监听保存
        form.on('submit(save)', function (event) {
            //发异步，把数据提交给php
            $.ajax({
                type: "POST",
                data: $('form').serialize(),
                dataType: "JSON",
                url: "{:url('user/update')}",
                success: function (data) {
                    if (data.status == 1) {
                        layer.alert(data.message, {icon: data.icon}, function () {
                            // 获得frame索引
                            var index = parent.layer.getFrameIndex(window.name);
                            // 关闭当前frame
                            parent.layer.close(index);
                        });
                    } else {
                        layer.msg(data.message, {icon: data.icon, time: 1000});
                    }
                }
            });
            return false;
        });
    });
</script>
</body>
</html>
